import {Washer} from '../../washers/shared/washer.model';

export class Order {
  public selected: boolean;

  public static isUnpaid(statusCode): boolean {
    return statusCode === 10;
  }
  public static isUnassigned(statusCode): boolean {
    return statusCode === 20;
  }
  public static isOngoing(statusCode): boolean {
    // return 30 <= this.statusCode < 40;
    return statusCode >= 30 && statusCode < 40;
  }
  public static isRefunding(statusCode): boolean {
    return statusCode === 50;
  }
  public static isCancelled(statusCode): boolean {
    return statusCode === -1;
  }
  public static isCompleted(statusCode): boolean {
    return statusCode === -10;
  }
  public static isProblem(statusCode): boolean {
    return statusCode === 0;
  }

  constructor(public orderId: number,
              public orderNumber: string,
              public serviceName: string,
              public bookTime: Date,
              public completedTime: Date,
              public createdTime: Date,

              public color: string,
              public license: string,
              public status: string,
              public statusCode: number,
              public fullAddress: string,

              public remarks: string,
              public price: number,
              public discountedPrice: number,
              public newPrice: number,

              public vehicleType: VehicleType,
              public vehicleCategory: VehicleCategory,
              public user: UserInfo,
              public washerInfo: WasherInfo
              // public createdTime: Date,
              // public address: string,
              // public detailLocation: string,
              // public bookTime: Date,
              // public completedTime: Date,
              // public orderTime: Date,
              // public status: string,
              // public statusCode: number,
              // public discount: number,
              // public remarks: string,
              // public user: User,
              // public service: Service,
              // public vehicle: Vehicle,
              // public washers: Washer[]
  ) {
  }
}
class VehicleType {
  constructor(
    public id: number,
    public name: string
  ) {}
}
class VehicleCategory {
  constructor(
    public id: number,
    public name: string
  ) {}
}
class UserInfo {
  constructor(
    public id: number,
    public createdTime: Date,
    public nickName: string,
    public firstName: string,
    public lastName: string,
    public genderId: number,
    public phoneNumber: string,
    public age: number,
    public detailLocation: string
  ) {}
}

class WasherInfo {
  constructor(
    public id: number,
    public createdTime: Date,
    public firstName: string,
    public lastName: string,
    public nickName: string,
    public phoneNumber: string,
    public identityId: string,
    public gender: string,
    public level: string
  ) {}
}

class User {
  constructor(public id: number,
              public name: string,
              public mobile: string,
              public gender: string) {
  }
}

class Service {
  constructor(public id: number,
              public name: string) {
  }
}

class Vehicle {
  constructor(public type: string,
              public category: string) {
  }
}
export class OrderToUpdate {

  public couponId: number;
  public promotionId: number;
  public operatorId: number;

  constructor(
    public id: number,
    public bookTime: string,
    // public detailLocation: string,
    public statusCode: number,
    public price: number,
    public license: string,
    public discountedPrice: number,
    public remarks: string,
  ) {}
}
